# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI=1

inherit eutils qt4
DESCRIPTION="QStarDict is a StarDict clone written with using Qt"
HOMEPAGE="http://qstardict.ylsoftware.com/"
SRC_URI="http://qstardict.ylsoftware.com/files/${P}.tar.bz2"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86 ~amd64 ~ia64"
IUSE="dbus nls"
RDEPEND="
 || ( 
		>=x11-libs/qt-4.2
		(
			x11-libs/qt-core
			x11-libs/qt-gui
		)
	)
	dbus? ( || ( x11-libs/qt-dbus <x11-libs/qt-4.4[dbus] ) )
	>=dev-libs/glib-2.0"
DEPEND="${RDEPEND}"
PROVIDE="virtual/stardict"

src_compile() {
	QMAKE_FLAGS=""
	if ! use dbus; then
		QMAKE_FLAGS+="NO_DBUS=1 "
	fi
	if ! use nls; then
		QMAKE_FLAGS+="NO_TRANSLATIONS=1 "
	fi

	# If you want to select plugins to compile add
	#    ENABLED_PLUGINS="plugin1 plugin2 ..."
	# to qmake arguments.
	# Available plugins:
	#    * stardict - supports StarDict dictionaries
	#    * web - supports any web search engine
	#    * swac - supports SWAC speaking system (http://shtooka.net)
	#    * multitran - supports Multitran dictionaries (http://multitran.sourceforge.net)
	# By default the only "stardict" and "web" plugins enabled.

	eqmake4 "${PN}.pro" $QMAKE_FLAGS ENABLED_PLUGINS='stardict web'  || die "qmake failed"
	emake || die "emake failed"
}

src_install() {
	emake INSTALL_ROOT="${D}" install || die "emake install filed"
}

